//
//  LTFReadFifthCell.m
//  NeteaseNews
//
//  Created by liutaifeng on 16/4/20.
//  Copyright © 2016年 liutaifeng. All rights reserved.
//

#import "LTFReadFifthCell.h"
#import "IsNight.h"
#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
@implementation LTFReadFifthCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}



- (void)createView {
    //行高100
    self.background = [[UIView alloc] init];
    [self.contentView addSubview:self.background];
    //self.background.backgroundColor = [UIColor whiteColor];
    [_background release];
    
    self.titleLabel = [[UILabel alloc] init];
    [self.background addSubview:self.titleLabel];
    //self.titleLabel.backgroundColor = [UIColor redColor];
    [_titleLabel release];
    
    
    
    self.sort  = [[UILabel alloc] init];
    [self.background addSubview:self.sort];
    //self.sort.backgroundColor = [UIColor redColor];
    [_sort release];
    
    
    self.line = [[UIView alloc] init];
    [self.background addSubview:self.line];
    self.line.backgroundColor = [UIColor grayColor];
    [_line release];
    
    
}
- (void)layoutSubviews {
    [super layoutSubviews];
    if ([IsNight nowIsNight]) {
        _background.backgroundColor = [IsNight nightColor];
        _titleLabel.textColor = [IsNight textNightColor];
        _line.backgroundColor = [UIColor whiteColor];
        _sort.textColor = [IsNight textNightColor];
        self.contentView.backgroundColor = [IsNight nightColor];
        
    }
    else {
        _background.backgroundColor = [UIColor whiteColor];
        _titleLabel.textColor = [UIColor blackColor];
        _line.backgroundColor = [UIColor blackColor];
        _sort.textColor = [UIColor blackColor];
        self.contentView.backgroundColor = [UIColor whiteColor];
    }
    self.background.frame = CGRectMake(5, 5, WIDTH - 10, HEIGHT - 10);
    self.background.layer.borderWidth = 1;
    self.background.layer.cornerRadius = 5;
    self.titleLabel.frame = CGRectMake(10, 10 , WIDTH - 40, 50);
    self.titleLabel.numberOfLines = 0;
    [self.titleLabel sizeToFit];
    self.line.frame = CGRectMake(10, 58, WIDTH - 40, 1);
    
    self.sort.frame = CGRectMake(10, 63, WIDTH / 2, 20);
    self.sort.font = [UIFont systemFontOfSize:15];
    self.sort.textColor = [UIColor grayColor];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
